#ifndef _GSUPPLYLINKSOLUTION_H_
#define _GSUPPLYLINKSOLUTION_H_

#include <vector>

#include "gsupplyLinkProblem.h"
#include "gjobVariable.h"
#include "gbatchInformation.h"

using namespace std ;

//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
/**
 * Class of a loading sequence in the LSDSP
 *
 * @author      Olivier Grunder
 * @version     1.00
 * @date 13/10/2003
 */

class GSupplyLinkProblem ;

class GSupplyLinkSolution {

    protected:
        //GSupplyLinkProblem& problem ;
        GSupplyLinkProblem* problem ;

        /*
         * Structure of a feasible schedule ;
         */
        vector<GJobVariable> processingSchedule;

        /*
         * Number of batches
         */
        int nbrBatch;

        double evaluation ;
        double evaluationTransporter;
        double evaluationCustomer;

    public:
        GSupplyLinkSolution() ;
        GSupplyLinkSolution(GSupplyLinkProblem& pb_) ;

        // inline
        inline const double getEvaluation() const { return evaluation ; }
        inline void setNbrBatch(int nb) { nbrBatch = nb ; }

        inline int getBatchIndice(int i) {return processingSchedule[i].getBatchIndice() ;}
        inline void setBatchIndice(int i, int bi) {assert(i<processingSchedule.size()) ; processingSchedule[i].setBatchIndice(bi) ;}

        inline void setDeliveryCompletionTime(int i, double d) { processingSchedule[i].setDeliveryCompletionTime(d) ;}

        inline GJobVariable& getJobVariable(int i) { return processingSchedule[i] ;}
        inline void setJobVariable(int i, const GJobVariable& jobVar) { processingSchedule[i]=jobVar ;}

        // Methods
        double evaluate() ;
        bool checkConstraints() ;

    friend ostream& operator<< (ostream&, const GSupplyLinkSolution&) ;
} ;

ostream& operator<< (ostream&, const GSupplyLinkSolution&) ;

#endif
